#include <iostream>
#include <string>
#include <map>
using namespace std;

void Atoa(string& s)
{
    for (auto& e : s)
        if (e >= 'A' && e <= 'Z')
            e += 32;
}

int main()
{
    string s;
    map<string, int> countmap;
    while (cin >> s)
    {
        if (s.back() == '.')
            s.pop_back();
        Atoa(s);
        countmap[s]++;
    }

    multimap<int, string, greater<int>> ans;
    for (auto& e : countmap)
        ans.insert(make_pair(e.second, e.first));

    auto it = ans.begin();
    while (it != ans.end())
    {
        cout << it->second << ":" << it->first << endl;
        it++;
    }

    return 0;
}